# Maintainer: David Runge <dvzrv@archlinux.org>

_name=mujson
pkgname=python-mujson
pkgver=1.4
pkgrel=6
pkgdesc="Use the fastest JSON functions available at import time"
arch=('any')
url="https://github.com/mattgiles/mujson"
license=('MIT')
depends=('python')
makedepends=('python-setuptools')
# LICENSE not in tarball:
# https://github.com/mattgiles/mujson/issues/8
source=("https://files.pythonhosted.org/packages/source/${_name::1}/${_name}/${_name}-${pkgver}.tar.gz"
        "${pkgname}-LICENSE::https://raw.githubusercontent.com/mattgiles/mujson/ddab84d3c3f43c3510fc97bdea1d3c3eeff96e18/LICENSE")
sha512sums=('a205424e0663c8f793a1fcd07a719486c162b1a2e656f0afcbcc66095402ddea17918e11380f73a5590c759a9509d460509a54fc554df2b223936b22c1cdc872'
            'e067d31f2b14bb094f3a233b111741fa3c1c18f2ea48db9beae7a68b556cc259572c6e0e8aae4de4946f2274bee00a50e5d4d87e0c997b86b3a552998c74c0e6')

prepare() {
  mv -v "${_name}-${pkgver}" "$pkgname-$pkgver"
  cd "$pkgname-$pkgver"
}

build() {
  cd "$pkgname-$pkgver"
  python setup.py build
}

package() {
  cd "$pkgname-$pkgver"
  python setup.py install --skip-build \
    --optimize=1 \
    --prefix=/usr \
    --root="${pkgdir}"
  install -vDm 644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -vDm 644 ../${pkgname}-LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}
